package com.hzcx.app.simplechat.ui.friend;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.hzcx.app.simplechat.R;
import com.hzcx.app.simplechat.base.BaseActivity;
import com.hzcx.app.simplechat.ui.friend.event.FriendLableNameEvent;
import com.hzcx.app.simplechat.util.empty.EmptyUtils;

import org.greenrobot.eventbus.EventBus;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 填写标签名字
 */
public class FriendLableCreateNameActivity extends BaseActivity {

    public static final String INTENT_CONTENT = "INTENT_CONTENT";

    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.iv_title_right)
    ImageView ivTitleRight;
    @BindView(R.id.tv_title_right)
    TextView tvTitleRight;
    @BindView(R.id.et_content)
    EditText etContent;

    @Override
    public int getLayout() {
        return R.layout.activity_friend_lable_create_name;
    }

    @Override
    public void initPresenter() {

    }

    @Override
    public void initView() {
        tvTitle.setText("设置标签名字");
        tvTitleRight.setText("确定");

        etContent.setText(getIntent().getStringExtra(INTENT_CONTENT));
    }

    @Override
    public void initData() {

        tvTitleRight.setOnClickListener(view -> {
            if(EmptyUtils.isEmpty(etContent.getText().toString())){
                showError("请输入标签名字");
                return;
            }
            EventBus.getDefault().post(new FriendLableNameEvent(etContent.getText().toString()));
            finish();
        });

    }

}
